ASN.1: RFC 8410 OIDs, ABSENT params, Unknown key preservation, SEQUENCE OF support #108
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
ObjectIdentifierextensions: Ed25519, Ed448, X25519, X448.Asn1Any).Issue linkage
StructureKind.LIST).UnknownKeyAlgorithmIdentifier(algorithm, parameters)andAsn1Anyto preserve parameters.Details
RFC 8410 OIDs and encoding rules
asn1/modules:ObjectIdentifier.Companion.Ed25519→ 1.3.101.112ObjectIdentifier.Companion.Ed448→ 1.3.101.113ObjectIdentifier.Companion.X25519→ 1.3.101.110ObjectIdentifier.Companion.X448→ 1.3.101.111internal fun ObjectIdentifier.isRfc8410NoParams()groups the four OIDs.KeyAlgorithmIdentifierSerializer.encodeParametersomits the "parameters" element for these OIDs (ABSENT). RSA remains explicit NULL; EC unchanged.UnknownKeyAlgorithmIdentifier.Unknown AlgorithmIdentifier preservation (round‑trip)
Asn1Anycaptures raw TLV bytes of unknown parameters.UnknownKeyAlgorithmIdentifiernow storesparameters: Any?(previouslyNothing?), usingAsn1Anywhen present.parametersisAsn1Any, write it back as‑is; if null, omit.SEQUENCE OF (lists)
DerDecoderandDerEncodernow handleStructureKind.LISTto encode/decodeSEQUENCE OFvalues.Tests
SEQUENCE OF INTEGERencode/decode (+ empty list).CI
.github/workflows/run-tests-asn1.ymlruns quick, focused matrix for ASN.1 core and modules: JVM, JS, Wasm Node, Linux x64.run-checks.yml(runs after build) to increase cross‑platform confidence without slowing the entire pipeline.API / ABI notes
dev.whyoleg.cryptography.serialization.asn1.Asn1Any(core ASN.1 module).UnknownKeyAlgorithmIdentifiersignature changed:UnknownKeyAlgorithmIdentifier(algorithm: ObjectIdentifier)withparameters: Nothing?UnknownKeyAlgorithmIdentifier(algorithm: ObjectIdentifier, parameters: Any? = null)cryptography-serialization-asn1-modules(API files updated). Typical use sites constructing unknown identifiers remain source‑compatible if they do not reference the oldparameterstype; call sites with 1‑arg constructor continue to work.Motivation and outcomes
Examples
30 05 06 03 2B 65 70(no parameters element).30 05 06 03 2B 65 6E.Backward compatibility notes
UnknownKeyAlgorithmIdentifier.parametersbeing alwaysnull, it may now holdAsn1Anyfor unknown algorithms with present parameters. Consumers can ignoreparametersor recognizeAsn1Anyto access raw TLV bytes when needed.Checklist against #21